home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2669 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  70 lines

  1. Newsgroups: comp.lang.smalltalk,comp.lang.c
  2. Path: news.fyi.net!news
  3. From: fireresq@fyi.net
  4. Subject: VisualAge IBM Smalltalk Primiative Problem
  5. X-Nntp-Posting-Host: 204.179.83.8
  6. Message-ID: <DLM6xL.HKz@fyi.net>
  7. Keywords: Smalltalk C Primative
  8. Sender: news@fyi.net (News User)
  9. Reply-To: fireresq@fyi.net
  10. Organization: MRR BlackSmithing
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12. Date: Tue, 23 Jan 1996 03:27:20 GMT
  13.  
  14. this is the definition of the array that gets passed to my c primative:
  15. | ary |
  16.     ary := Array new: 6.
  17.     ary at: 1 put: #name:.
  18.     ary at: 2 put: #makeProcWithName:.
  19.     ary at: 3 put: #uuid:.
  20.     ary at: 4 put: #version:.
  21.     ary at: 5 put: #makeConstWithName:.
  22.     ary at: 6 put: #putConstType:inConst:withValue:.
  23.  
  24. this is the code that that will be called by the EsSemdMessage:
  25. putConstType: aTypeString inConst: aClConstant withValue: anObject
  26.     "Test:
  27.  
  28. this is the section of code that will exicute in the c dll to call back to
  29. SmallTalk:
  30.    EsObject          result;
  31.    EsObject          s1, s2, s3;
  32.    EsObject          selector;
  33.  
  34.    s1 = createString(EsPrimVMContext, "s1");
  35.    s2 = createString(EsPrimVMContext, "s2");
  36.    s3 = createString(EsPrimVMContext, "s3");
  37.    selector = EsAt(selectorArray, (U_32) 6);
  38.    rc = EsSendMessage(EsPrimVMContext, &result, parserClass, selector,
  39.                         3, s1, s2, s3);
  40.  
  41. This is a c function to create a string object:
  42. EsObject createString(EsVMContext EsPrimVMContext, char * str)
  43. {
  44.    EsObject result;
  45.    U_32 i, size;
  46.  
  47.    size = strlen(str);
  48.    result = EsAllocateObject(EsPrimVMContext,EsPrimClassString,
  49.                              size, 0, (EsObject **) NULL);
  50.    if (result != (EsObject) NULL)
  51.       for (i = 0; i < size; ++i)
  52.          EsByteAtPut(result, i + 1, (U_8) str[i]);
  53.  
  54.    return(result);
  55. }
  56.  
  57. I hope I have given you enough information to make suggestions.  If noe please
  58. feel free to ask me questions on this news group or by e-mail.
  59.  
  60. 1) My question is everytime i make the call to #putConstType:inConst:withValue:
  61. I get a 21 returned from EsSend Message.  Does Anyone know what this means?
  62.  
  63. 2) Does onyone know a better way of getting selectors to make call backs to
  64. SmallTalk?
  65.  
  66. Thanks in advance for your help!
  67. Mark Russell
  68. Owner MRR Blacksmithing
  69. fireresq@fyi.net
  70.